import xlwt

workbook = xlwt.Workbook()
sheet = workbook.add_sheet("sheet1")

names=['张幸福','sadf','wr','234']
nums=[1,2,3,4]
sexArr=['男','女','男','nan']
studyArr=['12345','345264245','2342345','23455243']

num_index = 1
index = 1;
sex_index = 1
sty_index = 1

sheet.write(0,0,'序号')
sheet.write(0,1,'姓名')
sheet.write(0,2,'性别')
sheet.write(0,3,'学生编号')

for num in nums:

    sheet.write(num_index,0,num)
    num_index+=1

for name in names:

    sheet.write(index, 1, name)
    index+=1

for sex in sexArr:
    sheet.write(sex_index,2,sex)
    sex_index+=1

for study in studyArr:

    sheet.write(sty_index,3,study)
    sty_index+=1

workbook.save("test.xls")